import pytest

from utils.msyql_util import db


# 添加夹具fixture将banner_nums 变成前置条件
@pytest.fixture
# 查询数据库中的banner条数
def banner_nums():
    sql = "select count(1) as banner_nums from goods_banner"
    res = db.query(sql)
    return res['banner_nums']

def get_add_shop_car(mobile,goods):
    sql  = "select `id` as uid  from users_userprofile where mobile = '%s'" % mobile
    res = db.query(sql)
    uid = res['uid']
    sql = "select nums from trade_shoppingcart where goods_id = '%s' and user_id = '%s';" % (goods, uid)
    res = db.query(sql)
    return res['nums']